'''
依次放入项目中
'''
import os
import shutil

# D:\Code\TotalMarkDown\Python\VS_Code\settings.json
isFile_first = True;

arrList = ['D:\Code\AI-audit-sys',
           'D:\Code\/biv-web', 
           'D:\Code\imedia-web', 
           'D:\Code\smartrv-web', 
           'D:\Code\/teenagerStrong\/teenagerStrong-admin',
           'D:\Code\/teenagerStrong\/teenagerStrong-youth', 
           'D:\Code\/fcm_management',
           'D:\Code\ssc-control',
           'D:\Code\elevator-web',
           'D:\Code\Intelligent-media-platform',
           'D:\Code\pim-html',
           'D:\Code\mes-html',
           'D:\Code\SmartSphere-ui',
           'D:\Code\/baseEdit-design',
           'D:\Code\ioc-html', 
           'D:\Code\charging-pile-web','D:\Code\imes-ui','D:\Code\ccabinet-web','C:\Users\wangwenli\AppData\Roaming\Code\User\snippets' ]
arrCopyFile = [
    'Python\VS_Code\settings.json', 
    'Python\VS_Code\snippet_code.code-snippets', 
    'Python\VS_Code\elevatorForm.code-snippets', 
    'Python\VS_Code\/useFunction.code-snippets', 
    'Python\VS_Code\/react_typescript.code-snippets']

lastFile = '\.vscode'
resultFile = '\.hbuilderx'


def copyFile(target):
    try:
        for fileValue in arrCopyFile:
            shutil.copy(os.path.join(os.getcwd(), fileValue),target)
            print('复制成功：' + target)
    except IOError as e:
        print("Unable to copy file. %s" % e)
    except:
        print("Unexpected error:")


for fileValue in arrCopyFile:
    isFile_first = os.path.exists(os.path.join(os.getcwd(), fileValue))
    if isFile_first == False:
        print(os.path.join(os.getcwd(), fileValue))
        break;

if isFile_first:
    for item in arrList:
        if os.path.exists(item):
            if not os.path.exists(item + lastFile):
                os.mkdir(item + lastFile)
            copyFile(item + lastFile)
            if not os.path.exists(item + resultFile):
                os.mkdir(item + resultFile)
            copyFile(item + resultFile)
else: print('请检查文件')



    


    